//
//  MySelfCell.m
//  shiHuo
//
//  Created by zhiyou on 16-4-14.
//  Copyright (c) 2016年 zhiyou. All rights reserved.
//

#import "MySelfCell.h"

@implementation MySelfCell

- (void)awakeFromNib {
    // Initialization code
}
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        self.backgroundColor = [UIColor whiteColor];
        _gradesLab = [[UILabel alloc] init];
        _gradesLab.text = [NSString stringWithFormat:@"0\n积分"];
        _gradesLab.textAlignment = NSTextAlignmentCenter;
        _gradesLab.numberOfLines = 2;
        _gradesLab.font = [UIFont systemFontOfSize:14];
        [self addSubview:_gradesLab];
        _goldLab = [[UILabel alloc] init];
        _goldLab.textAlignment = NSTextAlignmentCenter;
        _goldLab.numberOfLines = 2;
        _goldLab.font = [UIFont systemFontOfSize:14];
        _goldLab.text = [NSString stringWithFormat:@"0\n金币"];
        [self addSubview:_goldLab];
        _balanceLab = [[UILabel alloc] init];
        _balanceLab.numberOfLines = 2;
        _balanceLab.textAlignment = NSTextAlignmentCenter;
        _balanceLab.text = [NSString stringWithFormat:@"0\n余额"];
        _balanceLab.font = [UIFont systemFontOfSize:14];
        [self addSubview:_balanceLab];
        _signBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _signBtn.backgroundColor = [UIColor redColor];
        _signBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        [_signBtn setTitle:@"签到送积分" forState:UIControlStateNormal];
        [self addSubview:_signBtn];
        _verticalLab1 = [[UILabel alloc] init];
        _verticalLab1.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:_verticalLab1];
        _verticalLab2 = [[UILabel alloc] init];
        _verticalLab2.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:_verticalLab2];
        _verticalLab3 = [[UILabel alloc] init];
        _verticalLab3.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:_verticalLab3];
        [_gradesLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.equalTo(self.mas_width).multipliedBy(.2);
            make.width.equalTo(_goldLab.mas_width);
            make.width.equalTo(_balanceLab.mas_width);
            make.left.top.bottom.offset(0);
            
        }];
        [_verticalLab1 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.offset(8);
            make.bottom.offset(-8);
            make.width.equalTo(self.mas_width).multipliedBy(0.003);
            make.left.equalTo(_gradesLab.mas_right).offset(0);
            make.right.equalTo(_goldLab.mas_left).offset(0);
        }];
        [_goldLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.offset(0);
            make.left.equalTo(_verticalLab1.mas_right).offset(0);
            make.right.equalTo(_verticalLab2.mas_left).offset(0);
        }];
        [_verticalLab2 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.offset(8);
            make.bottom.offset(-8);
            make.width.equalTo(_verticalLab1);
            make.width.equalTo(_verticalLab3);
            make.right.equalTo(_balanceLab.mas_left).offset(0);
        }];
        [_balanceLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.bottom.offset(0);
            make.right.equalTo(_verticalLab3.mas_left).offset(0);
            
        }];
        [_verticalLab3 mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.offset(8);
            make.bottom.offset(-8);
            make.right.equalTo(_signBtn.mas_left).offset(-15);
            make.left.equalTo(_balanceLab.mas_right).offset(0);
        }];
        [_signBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.mas_centerY);
            make.right.offset(-15);
            make.left.equalTo(_verticalLab3.mas_right).offset(15);
        }];

    }
    return self;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
